﻿SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ARITHABORT ON
GO
SET NUMERIC_ROUNDABORT OFF
GO
SET CONCAT_NULL_YIELDS_NULL ON
GO
SET ANSI_PADDING ON
GO
SET ANSI_WARNINGS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER PROCEDURE [dbo].[bhp_WebReservationGetApartments]
	@ReservationId		INT
AS
BEGIN
	SELECT
		pr.apartament as ApartmentId,
		pr.liczba_osob as PeopleCount,
		pr.idx as RecordId,
		pr.wartosc as Price
	FROM
		REZERWACJA r
		INNER JOIN REZERWACJA_pozycje_rezerwacji rpr ON r.idx = rpr.idx
		INNER JOIN REZERWACJA_POZYCJE pr ON rpr.rel = pr.idx
	WHERE
		r.idx = @ReservationId
		AND r.del = 0
	
END